package com.smilive.start.netty.rpc;

import com.smilive.start.netty.rpc.peotocol.SerializerAlgorithm;
import sun.security.krb5.Config;

import java.io.InputStream;
import java.util.Properties;

/**
 * @program: netty
 * @Date: 2022-01-11 11:25
 * @Author: smilive
 * @Description:
 */
public class RpcConfig {
    static Properties properties;
    static {
        try (InputStream in = Config.class.getResourceAsStream("/application.properties")){
            properties = new Properties();
            properties.load(in);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static SerializerAlgorithm getSerializerAlgorithm(){
        String value = properties.getProperty("serializer.algorithm");
        if (value == null){
            return SerializerAlgorithm.Java;
        }
        return SerializerAlgorithm.valueOf(value);
    }

}
